home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-01-16 | 27.2 KB | 933 lines | [TEXT/pdos] |
- /*---------------------- Top ---------------------------*/
- /* RezIIGS source file for LeMaze */
-
- /* this gives use access to the "standard" pre-defined resource types */
- #include "Types.rez"
-
- /*---------------------- Startup Record ---------------------------*/
- resource rToolStartup (1)
- {
- $C080, /* set master SCB to mode640 + fFastPortAware + fUseShadowing */
- {
- 3,$0000, /* misc tools */
- 4,$0000, /* quickdraw */
- 5,$0000, /* desk manager */
- 6,$0000, /* eventMgr */
- 11,$0000, /* int math */
- 14,$0000, /* Window Manager */
- 15,$0000, /* Menu Manager */
- 16,$0000, /* Control Manager */
- 18,$0000, /* QD Aux */
- 19,$0000, /* print manager */
- 20,$0000, /* LineEdit tool set */
- 21,$0000, /* Dialog Manager */
- 22,$0000, /* Scrap manager */
- 23,$0000, /* standard file */
- 27,$0000, /* Font manager */
- 28,$0000, /* list manager */
- 34,$0000, /* text edit */
- }
- };
-
- /*---------------------- Menus & Menu Bars ---------------------------*/
- /* define the resource id of the menu bar itself */
- #define kMenuBarID1 1
-
- /* define all the menu id's */
- #define kAppleMID 1000
- #define kFileMID 2000
- #define kEditMID 3000
-
- /* now, define the menu item id's */
- #define kAboutBoxIID 1001 /* the "About..." box */
-
- #define kNewItem 2001 /* the "New" item */
- #define kOpenItem 2002 /* the "Open..." item */
- #define kCloseItem 255 /* the "Close" item */
- #define kSaveItem 2004 /* the "Save" item */
- #define kSaveAsItem 2005 /* the "Save As..." item */
- #define kQuitItem 2009 /* the "Quit" item */
-
- #define kUndoItem 250 /* the "Undo" item */
- #define kCutItem 251 /* the "Cut" item */
- #define kCopyItem 252 /* the "Copy" item */
- #define kPasteItem 253 /* the "Paste" item */
- #define kClearItem 254 /* the "Clear" item */
- #define kSelectItem 3001 /* the "Select All" item */
- #define kShowClipItem 3002 /* the "Show Clipboard" item */
-
- /* now, define the menu bar */
- resource rMenuBar (kMenuBarID1)
- {
- {
- kAppleMID,
- kFileMID,
- kEditMID,
- };
- };
-
-
- /* lay out the Apple menu */
- /* this takes several steps: */
- /* 1) define the menu itself in a resource of type "rMenu" */
- /* 2) define the rPString that will be used for the name of the menu */
- /* 3) define the first item in the menu in a resource of type "rMenuItem" */
- /* 4) define the rPString that will be used for the name of the first item */
- /* 5) repeat steps 3 and 4 for all remaining items in that menu */
- /* 6) repeat steps 1 through 5 for all remaining menus */
-
- resource rMenu (kAppleMID, nocrossbank)
- {
- kAppleMID, /* ID of the menu this item belongs to */
- 0xA008, /* flags => menu title is a resource, items are resources, menu */
- /* is enabled, XOR highlighting, std menu, caching ok */
- kAppleMID, /* ref to menu's title */
- { kAboutBoxIID }; /* array of items in this menu (only 1 to start with) */
- };
-
- resource rPString (kAppleMID, nocrossbank)
- {
- "@" /* this string is the title of the "Apple" menu */
- };
-
- /* see IIGS Toolbox Reference, Volume 3, menu item template */
- resource rMenuItem (kAboutBoxIID, nocrossbank)
- {
- kAboutBoxIID, /* item's ID */
- "", /* no keyboard equivalent */
- "", /* no keyboard equivalent (allowed 2, this is the 2nd) */
- 0, /* this item does not have a check mark by it */
- 0x8040, /* title is in a resource, enabled (bit 7=0), */
- /* dividing line below (bit 6=1) */
- kAboutBoxIID /* ref of the item's title */
- };
-
- resource rPString (kAboutBoxIID, nocrossbank)
- {
- "About rTutor" /* used as the title for the "About..." item */
- };
-
-
- /* lay out the File menu */
-
- resource rMenu (kFileMID, nocrossbank)
- {
- kFileMID, /* ID of the menu this item belongs to */
- 0xA008, /* flags => menu title is a resource, items are resources, */
- /* menu is enabled, don't use XOR highlighting, std menu, */
- /* caching ok */
- kFileMID, /* ref to menu's title */
- { /* array of items in this menu */
- kNewItem,
- kOpenItem,
- kCloseItem,
- kSaveItem,
- kSaveAsItem,
- kQuitItem
- };
- };
-
- resource rPString (kFileMID, nocrossbank)
- {
- " File " /* this string is the title of the "File" menu */
- };
-
- resource rMenuItem (kNewItem, nocrossbank)
- {
- kNewItem, /* item's ID */
- "N", /* keyboard equivalent = "N" */
- "n", /* or = "n" (either key will work) */
- 0, /* this item does not have a check mark by it */
- 0x8000, /* title is in a resource, enabled (bit 7 = 0) */
- kNewItem /* ref of the item's title */
- };
-
- resource rPString (kNewItem, nocrossbank)
- {
- "New" /* this string is used as the title for the "New" item */
- };
-
- resource rMenuItem (kOpenItem, nocrossbank)
- {
- kOpenItem,
- "O", /* that's an "OH" on this line, not a "zero" */
- "o", /* that's an "OH" on this line, not a "zero" */
- 0, /* this one's a "zero" */
- 0x8040, /* the "4" means put a dividing line under this item */
- kOpenItem
- };
-
- resource rPString (kOpenItem, nocrossbank)
- {
- "Open..."
- };
-
- resource rMenuItem (kCloseItem, nocrossbank)
- {
- kCloseItem,
- "W",
- "w",
- 0,
- 0x8000,
- kCloseItem
- };
-
- resource rPString (kCloseItem, nocrossbank)
- {
- "Close"
- };
-
- resource rMenuItem (kSaveItem, nocrossbank)
- {
- kSaveItem,
- "S",
- "s",
- 0,
- 0x8000,
- kSaveItem
- };
-
- resource rPString (kSaveItem, nocrossbank)
- {
- "Save"
- };
-
- resource rMenuItem (kSaveAsItem, nocrossbank)
- {
- kSaveAsItem,
- "", /* no key equivalents for this item */
- "",
- 0,
- 0x8000,
- kSaveAsItem
- };
-
- resource rPString (kSaveAsItem, nocrossbank)
- {
- "Save As..."
- };
-
- resource rMenuItem (kQuitItem, nocrossbank)
- {
- kQuitItem,
- "Q",
- "q",
- 0,
- 0x8000,
- kQuitItem
- };
-
- resource rPString (kQuitItem, nocrossbank)
- {
- "Quit"
- };
-
-
- /* lay out the Edit menu */
-
- resource rMenu (kEditMID, nocrossbank)
- {
- kEditMID, /* ID of the menu this item belongs to */
- 0xA008,
- kEditMID, /* ref to menu's title */
- { /* array of items in this menu */
- kUndoItem,
- kCutItem,
- kCopyItem,
- kPasteItem,
- kClearItem,
- kSelectItem,
- kShowClipItem
- };
- };
-
- resource rPString (kEditMID, nocrossbank)
- {
- " Edit " /* this string is the title of the "Edit" menu */
- };
-
- resource rMenuItem (kUndoItem, nocrossbank)
- {
- kUndoItem,
- "Z",
- "z",
- 0,
- 0x8040,
- kUndoItem
- };
-
- resource rPString (kUndoItem, nocrossbank)
- {
- "Undo"
- };
-
- resource rMenuItem (kCutItem, nocrossbank)
- {
- kCutItem,
- "X",
- "x",
- 0,
- 0x8000,
- kCutItem
- };
-
- resource rPString (kCutItem, nocrossbank)
- {
- "Cut"
- };
-
- resource rMenuItem (kCopyItem, nocrossbank)
- {
- kCopyItem,
- "C",
- "c",
- 0,
- 0x8000,
- kCopyItem
- };
-
- resource rPString (kCopyItem, nocrossbank)
- {
- "Copy"
- };
-
- resource rMenuItem (kPasteItem, nocrossbank)
- {
- kPasteItem,
- "V",
- "v",
- 0,
- 0x8000,
- kPasteItem
- };
-
- resource rPString (kPasteItem, nocrossbank)
- {
- "Paste"
- };
-
- resource rMenuItem (kClearItem, nocrossbank)
- {
- kClearItem,
- "",
- "",
- 0,
- 0x8000,
- kClearItem
- };
-
- resource rPString (kClearItem, nocrossbank)
- {
- "Clear"
- };
-
- resource rMenuItem (kSelectItem, nocrossbank)
- {
- kSelectItem,
- "A",
- "a",
- 0,
- 0x8040, /* the "4" means this one has a divider under it */
- kSelectItem
- };
-
- resource rPString (kSelectItem, nocrossbank)
- {
- "Select All"
- };
-
- resource rMenuItem (kShowClipItem, nocrossbank)
- {
- kShowClipItem,
- "",
- "",
- 0,
- 0x8000,
- kShowClipItem
- };
-
- resource rPString (kShowClipItem, nocrossbank)
- {
- "Show Clipboard"
- };
-
-
- /*---------------------- Windows --------------------------*/
- /* define the resource ID's for all windows used by this app */
- #define myWindowID 2362 /* window's resource ID = 2362 */
-
- /* First, we lay out the window itself */
- resource rWindParam1 (myWindowID)
- {
- fTitle+fMove+fVis, /* has a title, can be moved, and it is visible */
- myWindowID, /* resource ID of the title */
- 0, /* no ref Con needed */
- {0,0,0,0}, /* no zoom box, so we don't care about the zoom rect */
- 0, /* use std color table for now */
- {0,0}, /* upper left corner of vis rgn = upper left of document */
- {0,0}, /* we don't really have a "document" for this window, so */
- /* set the data size to zero */
- {0,0}, /* maximum height and width */
- {0,0}, /* don't scroll vertically or horizontally */
- {0,0}, /* no "document", so page size is zero also */
- 0, /* passed to info bar draw routine - not used here */
- 0, /* height of info bar - not used here */
- {28,2,196,638}, /* this rect defines the boundaries of the window */
- infront, /* window comes up in front of other windows */
- 0, /* set to NIL to avoid bug in NewWindow2 */
- refIsResource*0x0100+resourceToResource /* title string and */
- /* control list are resources */
- };
-
- /* define the title string used by our window */
- resource rPstring (myWindowID)
- {
- " Level 1 "
- };
-
-
-
- /*--------- Alert Window - used as our About Box --------------------*/
-
- #define kAboutStr 100 /* define the constant for the About box's string */
-
- resource rAlertString (kAboutStr)
- {
- "\$30" /* we're using a custom sized box */
- "\$1E\$00" /* top coord (v1) for custom sized box */
- "\$AA\$00" /* left coord (h1) for custom sized box */
- "\$B0\$00" /* bottom coord (v2) for custom sized box */
- "\$D6\$01" /* right coord for (h2) custom sized box */
- "\$30" /* no icon in the window */
- "/" /* seperator character */
- TBEndOfLine /* stick an extra blank line in there */
- TBEndOfLine /* stick an extra blank line in there */
- TBCenterJust /* center the text */
- TBStyleBold /* turn on bold face */
- "rTutor.S16" /* the first line of text */
- TBEndOfLine /* mark the end of the line */
- TBEndOfLine /* stick an extra blank line in there */
- TBStylePlain /* turn off bold face */
- "The resource tutorial application" /* the next line of text */
- TBEndOfLine /* mark the end of the line */
- TBEndOfLine /* stick an extra blank line in there */
- TBStylePlain /* turn off italics */
- TBForeColor /* set foreground color to... */
- TBColor0 /* ...black */
- "written by:" /* another line of text */
- TBEndOfLine /* mark the end of the line */
- TBEndOfLine /* stick an extra blank line in there */
- TBForeColor /* set foreground color to... */
- TBColor1 /* ...red */
- "Tim Swihart" /* the name of this app's author */
- TBEndOfLine /* mark the end of the line */
- TBEndOfLine /* stick an extra blank line in there */
- TBEndOfLine /* stick an extra blank line in there */
- TBStylePlain /* turn off bold face */
- TBForeColor /* set foreground color to... */
- TBColor0 /* ...black */
- "Version 3.5" /* last line of text */
- "/" /* "/" is our seperator character */
- "^Thanks, Tim!" /* "^" means make the button the "default" (tie it to */
- /* the RETURN key) - make the button's text be "Thanks, Tim!" */
- "\$00" /* make sure the string is NULL terminated since we told */
- /* the window manager we would be using a C string */
- };
-
-
- /*---------------------- Icons ---------------------------*/
- #define kFloorIcon 1 /* for the floor tiles */
- #define kPoleIcon 2 /* for the up/down pole */
- #define kCoinIcon 3 /* gold coin */
- #define kGemIcon 4 /* diamond */
- #define kRockIcon 5 /* rock */
- #define kLeftIcon 6 /* man facing left */
- #define kRightIcon 7 /* man facing right */
- #define kCenterIcon 8 /* man facing forward */
- #define kLeft2Icon 9 /* icon for halfway between positions moving left */
- #define kRight2Icon 10 /* icon for halfway between positions moving right */
- #define kSplatIcon 11 /* icon for player that fell too far */
- #define kEraserIcon 255 /* solid white icon for erasing other icons */
-
-
- resource rIcon (kFloorIcon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"555555FF" /* array of pixels in the icon's image */
- $"5EEEE5FF"
- $"85EE58FF"
- $"A8558AFF"
- $"A8558AFF"
- $"85EE58FF"
- $"5EEEE5FF"
- $"555555FF",
-
- $"FFFFFF00" /* array of pixels in the icon's image */
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00";
- };
-
-
- resource rIcon (kPoleIcon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FF55FFFF" /* array of pixels in the icon's image */
- $"FF55FFFF"
- $"FF55FFFF"
- $"FF55FFFF"
- $"FF55FFFF"
- $"FF55FFFF"
- $"FF55FFFF"
- $"FF55FFFF",
-
- $"FFFFFF00" /* array of pixels in the icon's image */
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00";
- };
-
-
- resource rIcon (kCoinIcon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FFFFFFFF" /* array of pixels in the icon's image */
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFF6FFFF"
- $"FF666FFF"
- $"FFF6FFFF",
-
- $"FFFFFF00" /* array of pixels in the icon's image */
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00";
- };
-
-
- resource rIcon (kGemIcon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FFFFFFFF" /* array of pixels in the icon's image */
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFDDDFFF"
- $"FDEEEDFF"
- $"FFDEDFFF"
- $"FFFDFFFF",
-
- $"FFFFFF00" /* array of pixels in the icon's image */
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00";
- };
-
-
- resource rIcon (kRockIcon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FFFFFFFF" /* array of pixels in the icon's image */
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFF00FFF"
- $"FF0000FF"
- $"FF0000FF"
- $"FFF00FFF",
-
- $"FFFFFF00" /* array of pixels in the icon's image */
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00";
- };
-
-
- resource rIcon (kLeftIcon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FFF0FFFF" /* array of pixels in the icon's image */
- $"FF0A0FFF"
- $"FFF00FFF"
- $"FFFF0FFF"
- $"FF000FFF"
- $"FFFF0FFF"
- $"FFF0F0FF"
- $"F00F00FF",
-
- $"00FFF000" /* array of pixels in the icon's image */
- $"0FFFFF00"
- $"0FFFFF00"
- $"0FFFFF00"
- $"0FFFFF00"
- $"0FFFFF00"
- $"0FFFFF00"
- $"FFFFFF00";
- };
-
-
- resource rIcon (kRightIcon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FFF0FFFF" /* array of pixels in the icon's image */
- $"FF0A0FFF"
- $"FF00FFFF"
- $"FF0FFFFF"
- $"FF000FFF"
- $"FF0FFFFF"
- $"F0F0FFFF"
- $"F00F00FF",
-
- $"00FFF000" /* array of pixels in the icon's image */
- $"0FFFFF00"
- $"0FFFFF00"
- $"0FFFFF00"
- $"0FFFFF00"
- $"0FFFFF00"
- $"FFFFFF00"
- $"FFFFFF00";
- };
-
- resource rIcon (kCenterIcon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FFF0FFFF" /* array of pixels in the icon's image */
- $"FF0A0FFF"
- $"FFF0FFFF"
- $"FFF0FFFF"
- $"F00000FF"
- $"FFF0FFFF"
- $"FF0F0FFF"
- $"F00F00FF",
-
- $"00FFF000" /* array of pixels in the icon's image */
- $"0FFFFF00"
- $"00FFF000"
- $"00FFF000"
- $"FFFFFF00"
- $"00FFF000"
- $"0FFFFF00"
- $"FFFFFF00";
- };
-
- resource rIcon (kLeft2Icon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FFF0FFFF" /* array of pixels in the icon's image */
- $"FF0A0FFF"
- $"FFF00FFF"
- $"FFFF0FFF"
- $"FFF00FFF"
- $"FFFF0FFF"
- $"FFFF0FFF"
- $"FFF00FFF",
-
- $"00FFF000" /* array of pixels in the icon's image */
- $"0FFFFF00"
- $"00FFFF00"
- $"00FFFF00"
- $"00FFFF00"
- $"00FFFF00"
- $"00FFFF00"
- $"00FFFF00";
- };
-
- resource rIcon (kRight2Icon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FFF0FFFF" /* array of pixels in the icon's image */
- $"FF0A0FFF"
- $"FF00FFFF"
- $"FF0FFFFF"
- $"FF00FFFF"
- $"FF0FFFFF"
- $"FF0FFFFF"
- $"FF00FFFF",
-
- $"00FFF000" /* array of pixels in the icon's image */
- $"0FFFFF00"
- $"0FFFF000"
- $"0FFF0000"
- $"0FFFF000"
- $"0FFF0000"
- $"0FFF0000"
- $"0FFFF000";
- };
-
- resource rIcon (kSplatIcon, purgeable1, nocrossbank)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FFFFFFFF" /* array of pixels in the icon's image */
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFF0FFFF"
- $"FF0A0FFF"
- $"F0F0F0FF"
- $"FF000FFF",
-
- $"FFFFFF00" /* array of pixels in the icon's image */
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00";
- };
-
- /* set the preload bit to be sure it's waiting for us in RAM */
- resource rIcon (kEraserIcon, purgeable1, nocrossbank, preload)
- {
- 0x8000, /* bit 15 = 1, so it's a color icon */
- 8, /* height = 8 pixels */
- 8, /* width = 8 pixels */
- $"FFFFFFFF" /* array of pixels in the icon's image */
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFFFFFFF"
- $"FFFFFFFF",
-
- $"FFFFFF00" /* array of pixels in the icon's image */
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00"
- $"FFFFFF00";
- };
-
-
- /*---------------------- SpotLists ---------------------------*/
- /* This is a new type of resource, so I'll have to define its template */
- /* before I can use it. We'll use it to save space on the "levels" in */
- /* this game -> rather than just manually call DrawIcon() a zillion times, */
- /* we'll create a custom data structure (represented by this resource */
- /* template) that contains the pixel coordinates of each icon we want to */
- /* draw as as well as each icon's "grid" location (superimpose a grid on */
- /* the screen & each icon fit into one grid square). We use the "grid" to */
- /* make it easier to make our player "move" (we'll get into HOW it moves */
- /* next time). If you're lost, then see the detailed docs that came with */
- /* this release. */
-
- /* The structure is fairly simple - it's just a list of "spots" (a "spot" */
- /* is a POINT and two integers - the POINT is where we want the upper left */
- /* corner of an icon to be drawn, the integers represent which "row" and */
- /* "column" is being filled by an icon). We need to know how many spots */
- /* are in the list, so we let Rez count them for us by taking advantage of */
- /* the "$$Countof" dirrective for Rez (see the manual for more details). */
- /* To add an icon to the screen, we simply put its spot info in the list */
- /* and recompile (you may want to break these lists into separate files and */
- /* use the -a option on the command line until you have the screen set up */
- /* the way you like it). */
-
- // simple list of points of icon locations and their array locations
- #define rMySpotList $6003
-
- type rMySpotList
- {
- integer=$$Countof(myIconSpots);
- array myIconSpots
- {
- point; /* upper left corner of the icon in local coords */
- integer; /* row this icon is in (0 to 20) */
- integer; /* column this icon is in (0 to 52) */
- };
- };
-
-
- /* Now we're ready to start using this custom resource template. */
- /* Since we know we'll want more than one "level" in our game, we need */
- /* a way to tell each level apart. Since the resource ID can be anything */
- /* we want it to be, why not use it? If we treat the resource ID as a hex */
- /* number, then we see it has 8 'digits' -> let's leave the first two zero, */
- /* the next two will be the ID of the icon that list is for, and the last */
- /* four will be the level this list is for. That lets us have 255 icons */
- /* and 65535 levels. If we need more icons some day, we can change this. */
- /* We calculate each resource ID by shifting the icon ID left four times */
- /* (multiplying by $10000 does the shift) and then adding the level number. */
- /* If you're lost, look at the ID in hex and think about how to get the */
- /* pieces where they belong. You'll see that it look like: */
- /* ID = $00xxyyyy where $xx = icon ID (0-255) and $yyyy = level (0-65535) */
-
-
- #define kL1 1 /* constant used for "level 1" */
-
- /* In order to "protect" our investment in all of the work it takes to lay */
- /* out a "spot list", we'll use a couple of constants to automate the */
- /* calculation of the pixel positions based on the desired row and column. */
- /* We just multiply the row number by the height of an icon to get the */
- /* desired row and we multiply the column number by the width of an icon to */
- /* get the desired column. If we make the icon taller, shorter, wider, or */
- /* thinner, we can simply adjust the two constants and all of the points */
- /* will automatically be taken care of when we recompile! Of course, */
- /* changing the size of the icons means a different number of them will fit */
- /* on the screen, so add or remove entries in the spot list to account for */
- /* this -> it will still be MUCH faster (and less prone to error) than */
- /* hard-coding all those pixel positions. */
-
- #define kIconHeight 8 /* used to calculate correct row */
- #define kIconWidth 12 /* used to calculate correct column */
-
- /* The array of where the floor icons are... */
- resource rMySpotList (kFloorIcon*0x00010000+kL1, purgeable1, nocrossbank)
- {
- {
- {3*kIconHeight, 4*kIconWidth}, 3, 4, /* v=24, h=48, row=3, column=8 */
- {3*kIconHeight, 5*kIconWidth}, 3, 5, /* (v=row*hieght) */
- {3*kIconHeight, 6*kIconWidth}, 3, 6, /* (h=column*width) */
- {3*kIconHeight, 7*kIconWidth}, 3, 7,
- {3*kIconHeight, 8*kIconWidth}, 3, 8,
- {3*kIconHeight, 9*kIconWidth}, 3, 9,
- {8*kIconHeight, 4*kIconWidth}, 8, 4,
- {8*kIconHeight, 5*kIconWidth}, 8, 5,
- {8*kIconHeight, 6*kIconWidth}, 8, 6,
- {8*kIconHeight, 7*kIconWidth}, 8, 7,
- {8*kIconHeight, 8*kIconWidth}, 8, 8,
- {8*kIconHeight, 9*kIconWidth}, 8, 9,
- {20*kIconHeight, 9*kIconWidth}, 20, 9, /* all the way at the bottom */
- {19*kIconHeight, 8*kIconWidth}, 19, 8, /* one up from the bottom */
- {8*kIconHeight, 52*kIconWidth}, 8, 52, /* all the way to the right */
- {7*kIconHeight, 51*kIconWidth}, 7, 51, /* one back from the right */
- {0*kIconHeight, 8*kIconWidth}, 0, 8, /* at the very top */
- {1*kIconHeight, 7*kIconWidth}, 1, 7, /* one down from the top */
- {1*kIconHeight, 0*kIconWidth}, 1, 0, /* all the way to the left */
- {2*kIconHeight, 1*kIconWidth}, 2, 1 /* one down from the top */
- };
- };
-
-
- /* This next list has its pixel positions hard coded. Make the icons */
- /* taller, then adjust the spot list for both the "floor" and "pole" icons. */
- /* Which is easier to adjust? Sometimes, more work up front makes it MUCH */
- /* easier to make changes later! */
-
- /* make the array of poles within the playfield */
- resource rMySpotList (kPoleIcon*0x00010000+kL1, purgeable1, nocrossbank)
- {
- {
- { 0, 60}, 0, 5,
- { 8, 60}, 1, 5,
- { 16, 60}, 2, 5,
- { 24, 60}, 3, 5,
- { 32, 60}, 4, 5,
- { 40, 60}, 5, 5,
- { 48, 60}, 6, 5,
- { 56, 60}, 7, 5,
- { 64, 60}, 8, 5,
- { 72, 60}, 9, 5,
- { 80, 60}, 10, 5,
- { 88, 60}, 11, 5,
- { 96, 60}, 12, 5,
- {104, 60}, 13, 5,
- {112, 60}, 14, 5,
- {112, 84}, 14, 7,
- {112,108}, 14, 9,
- {120, 60}, 15, 5,
- {120, 84}, 15, 7,
- {120,108}, 15, 9,
- {128, 60}, 16, 5,
- {136, 60}, 17, 5,
- {144, 60}, 18, 5,
- {152, 60}, 19, 5,
- {160, 60}, 20, 5
- };
- };
-
-
- /* place the player - always do this one last!*/
- resource rMySpotList (kLeftIcon*0x00010000+kL1, purgeable1, nocrossbank)
- {
- {
- {7*kIconHeight, 5*kIconWidth}, 7, 5
- };
- };
-
-
-
- /*---------------------- whichIconsUsed ---------------------------*/
- /* This is a new type of resource, so I'll have to define its template */
- /* before I can use it. It's just another custom "list" -> this one keeps */
- /* track of which icons we're using on this level (it also counts how many */
- /* icons are used per level). This way, we can add new types of icons (or */
- /* remove existing ones) by simply creating a "spotlist" for them and */
- /* putting their ID in the "whichIconsUsed" list -> no Changes to the app's */
- /* source code is needed (unless you want to assign new, specific behavior */
- /* to those icons). We only have to track usage by level number, so the */
- /* resource ID is simply the level the list represents -> i.e.: resource */
- /* ID = 1 means level 1, etc. */
-
- // simple list of which icons are used on this level
- #define rWhichIconsUsed $6002
-
- type rWhichIconsUsed // resource ID = game level
- {
- integer=$$Countof(whichIcons);
- array whichIcons
- {
- integer; /* resource ID of the icons used on this level */
- };
- };
-
- /* create the list for level 1 */
- resource rWhichIconsUsed (kL1, purgeable1, nocrossbank)
- {
- {
- kFloorIcon,
- kPoleIcon,
- kLeftIcon /* the player must be last in the list! */
- };
- };
-
-
-
- /*---------------------- Bottom ---------------------------*/
-